﻿<controls:ChildWindow xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="caedisi.Views.CellularAutomataSearchFilter"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           Width="800" Height="720" 
           xmlns:InfratructureModels ="clr-namespace:caedisi.Models"
           Title="CellularAutomataSearchFilter"
           DataContext="{Binding RelativeSource={RelativeSource Self}}"
                >
    
    <controls:ChildWindow.Resources>
        <InfratructureModels:GlobalVariableProvider x:Key="GlobalVariableProvider" />
    </controls:ChildWindow.Resources>                      
                     
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid Margin="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            
            <TextBox Width="150" />
            <Button Grid.Column="1" Content="Search" Width="50" HorizontalAlignment="Left" />
            <sdk:Label Content="Select the desired cellular automata" Grid.Row="1" Grid.ColumnSpan="2" />
            <sdk:DataGrid Grid.Row="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.ColumnSpan="2" SelectionMode="Single" ItemsSource="{Binding Path=CellularAutomatas, Mode=TwoWay}" Name="dataGridCas" IsEnabled="True" IsReadOnly="True">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" IsReadOnly="True"    Width="Auto" Binding="{Binding Path=Name}" Header="Name" />
                    <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" IsReadOnly="True"    Width="Auto" Binding="{Binding Path=Description}" Header="Description" MaxWidth="400"  />

                    <sdk:DataGridTemplateColumn x:Name="dgColumnAddressType" CanUserReorder="False" CanUserResize="True" CanUserSort="True"  IsReadOnly="True" Width="Auto" Header="Neigbhourhood Type">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <ComboBox  Grid.Row="3" Grid.Column="1"   IsEnabled="False"  ItemsSource="{Binding GlobalVariables.Lovs.NeighbourhoodTypes, Mode=TwoWay, Source={StaticResource GlobalVariableProvider}}" SelectedValuePath="NeighbourhoodTypeId" SelectedValue="{Binding NeighbourhoodTypeId, Mode=TwoWay}" >
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Margin="0,3,0,3">
                                                    <TextBlock Text="{Binding Name}" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>


                    <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" IsReadOnly="True"    Width="Auto" Binding="{Binding Path=Width}" Header="Width" />
                    <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" IsReadOnly="True"    Width="Auto" Binding="{Binding Path=Height}" Header="Height" />
                    <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" IsReadOnly="True"    Width="Auto" Binding="{Binding Path=RadiusVisibility}" Header="Radius visibility" />
                    <sdk:DataGridTextColumn CanUserReorder="True" CanUserResize="True" CanUserSort="True" IsReadOnly="True"    Width="Auto" Binding="{Binding Path=RadiusContamination}" Header="Contamination distance" />
                </sdk:DataGrid.Columns>
                
            </sdk:DataGrid>
        </Grid>

        <Grid Grid.Row="1">
            <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" />
            <Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" />
        </Grid>
    </Grid>
</controls:ChildWindow>